//
//  CFPrograssHUDController.m
//  CareFuture
//
//  Created by 许洋 on 2018/5/10.
//  Copyright © 2018年 zjab. All rights reserved.
//

#import "CFPrograssHUDController.h"
#import "CFProgressHUD.h"
@interface CFPrograssHUDController ()

@end

@implementation CFPrograssHUDController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.dataSource = @[@"Error",@"Message",@"Waiting",@"Loading",@"LoadingWithMessage",@"Saving",@"Success",];
    [self.tableView reloadData];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:
            [CFProgressHUD showError:@"错误" afterDelay:3];
            break;
        case 1:
            [CFProgressHUD showMessage:@"这是文字提示"];
            
            break;
        case 2:
            [CFProgressHUD showWaiting];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [CFProgressHUD hideHUD];
            });
            
            break;
        case 3:
            [CFProgressHUD showLoading];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [CFProgressHUD hideHUD];
            });
            break;
        case 4:
            [CFProgressHUD showLoadingWithMessage:@"自定义加载中"];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [CFProgressHUD hideHUD];
            });
            break;
        case 5:
            [CFProgressHUD showSaving];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [CFProgressHUD showSuccess:@"保存成功"];
            });
            break;
        case 6:
            [CFProgressHUD showSuccess:@"成功"];
            break;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
